package com.blb.javatest02.controller;

import com.blb.javatest02.entity.Employee;
import com.blb.javatest02.entity.ResponseResult;
import com.blb.javatest02.service.IEmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author chenheng
 * @since 2023-11-27
 */
@CrossOrigin
@RestController
public class EmployeeController {

    @Autowired
    private IEmployeeService employeeService;

    @GetMapping("/employees")
    public ResponseResult<List<Employee>> getAllEmp(){
        List<Employee> employees = employeeService.list();
        return ResponseResult.ok(employees);
    }
}
